home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
src
/
X11
/
xsw
/
bootinfo.c
next >
Wrap
C/C++ Source or Header
|
1995-05-09
|
10KB
|
425 lines
/***************************************************************************
*
* Copyright (c) 1990-1993 The Santa Cruz Operation, Inc.
*
* All rights reserved. No part of this program or publication may be
* reproduced, transmitted, transcribed, stored in a retrieval system,
* or translated into any language or computer language, in any form or
* by any means, electronic, mechanical, magnetic, optical, chemical,
* biological, or otherwise, without the prior written permission of:
*
* The Santa Cruz Operation , Inc. (408) 425-7222
* 400 Encinal St., Santa Cruz, California 95060 USA
*
**************************************************************************/
/*
* SCCS Stuff
*
* @(#) bootinfo.c 12.1 95/05/09 SCOINC
*
*
* S001, 01-Jan-93, rickra
* Added support for seperate windows, and reformatted
*
* S000, 30-Sep-92, rickra
* Added copyright and modification history
*/
/*+-------------------------------------------------------------------------
bootinfo.c - xsw bootinfo struct display
Defined functions:
bmemf_text(flags)
draw_Bootinfo(x,y)
--------------------------------------------------------------------------*/
/*+:EDITS:*/
/*:09-25-1990-05:11-wht@n4hgf-release heh-heh x0.22 preliminary */
/*:09-20-1990-00:09-wht@n4hgf-scales, sysinfo/minfo, bootinfo working */
/*:09-19-1990-23:17-wht@n4hgf-adapt u386mon source */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#include <Xm/Xm.h>
#include <Xm/MainW.h>
#include <Xm/DrawingA.h>
#include "include/unixincs.h"
#include "include/buttons.h"
#include "include/xsw.h"
static int line_style = LineSolid;
static int cap_style = CapButt;
static int join_style = JoinMiter;
/*+-------------------------------------------------------------------------
bmemf_text(flags)
--------------------------------------------------------------------------*/
char *
bmemf_text (flags)
ulong flags;
{
static char hex_errant[16];
ulong orig_flags = flags;
#if defined(B_MEM_DOWN) /* SCO only */
flags &= ~B_MEM_DOWN;
#endif
#if defined(B_MEM_EXPANS) /* ISC */
flags &= ~B_MEM_EXPANS;
#endif
#if defined(B_MEM_SHADOW) /* ISC */
flags &= ~B_MEM_SHADOW;
#endif
#if defined(B_MEM_TREV) /* ISC */
flags &= ~B_MEM_TREV;
#endif
if (!flags)
return (" ");
switch (flags)
{
case B_MEM_RSRVD:
return ("RSVD");
case B_MEM_KTEXT:
return ("KTXT");
case B_MEM_KDATA:
return ("KDTA");
case B_MEM_KBSS:
return ("KBSS");
case B_MEM_SPECIAL:
return ("SPCL");
case B_MEM_DOWN:
return ("DOWN");
case B_MEM_CANTDMA:
return ("NODM");
case B_MEM_EISA:
return ("EISA");
}
sprintf (hex_errant, "%04x", (ushort) orig_flags);
return (hex_errant);
} /* end of bmemf_text */
/*+-------------------------------------------------------------------------
machinetype_text(machine)
--------------------------------------------------------------------------*/
char *
machinetype_text (machine)
unsigned char machine;
{
switch (machine)
{
#if defined(UNKNOWN)
case UNKNOWN:
return ("");
break;
#endif
#if defined(COMPAQ)
case COMPAQ:
return ("Compaq");
break;
#endif
#if defined(TANDY)
case TANDY:
return ("Tandy");
break;
#endif
#if defined(Z1000)
case Z1000:
return ("Z1000");
break;
#endif
#if defined(WYSE)
case WYSE:
return ("Wyse");
break;
#endif
#if defined(IBM)
case IBM:
return ("IBM");
break;
#endif
#if defined(AT_BRIDGE)
case AT_BRIDGE:
return ("AT");
break;
#endif
#if defined(MITAC)
case MITAC:
return ("Mitac");
break;
#endif
#if defined(SYSTEMPRO)
case SYSTEMPRO:
return ("SystemPro");
break;
#endif
#if defined(APRICOT)
case APRICOT:
return ("Apricot");
break;
#endif
#if defined(UNISYS)
case UNISYS:
return ("Unisys");
break;
#endif
#if defined(HP)
case HP:
return ("HP");
break;
#endif
#if defined(OLIVETTI)
case OLIVETTI:
return ("Olivetti");
break;
#endif
#if defined(ACER)
case ACER:
return ("Acer");
break;
#endif
#if defined(TI)
case TI:
return ("TI");
break;
#endif
#if defined(NEC)
case NEC:
return ("NEC");
break;
#endif
#if defined(AST_MF)
case AST_MF:
return ("AST");
break;
#endif
}
return ("i386");
} /* end of ISC_machinetype_text */
/*+-------------------------------------------------------------------------
ISC_displaytype_text(adapter)
--------------------------------------------------------------------------*/
#if defined(ME_COMPAQVGA) /* ISC machdep.h */
char *
ISC_displaytype_text (adapter)
unsigned char adapter;
{
switch (adapter)
{
case ME_UNKNOWN:
return ("unknown to sys");
break;
case ME_EGA:
return ("EGA");
break;
case ME_CGA80:
return ("CGA");
break;
case ME_MONO:
return ("MONO");
break;
case ME_COMPAQHR:
return ("Compaq mono");
break;
case ME_Z449:
return ("Zenith Z449");
break;
case ME_T5100:
return ("Toshiba T5100");
break;
case ME_COMPAQVGA:
return ("Compaq VGA");
break;
case ME_OTHERVGA:
return ("VGA");
break;
#if defined(ME_PVGA1)
case ME_PVGA1:
return ("Paradise VGA1");
break;
#endif /* ME_PVGA1 */
#if defined(ME_V7VGA)
case ME_V7VGA:
return ("Video 7 VGA");
break;
#endif /* ME_V7VGA */
}
return ("???");
} /* end of ISC_displaytype_text */
#endif
/*+-------------------------------------------------------------------------
draw_Bootinfo(window,display,gc,DrawAreaXYWH,x,y)
--------------------------------------------------------------------------*/
int
draw_Bootinfo (SP, x, y)
struct NetworkXswStruct *SP;
int x;
int y;
{
Window window = SP -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].window;
Display *display = SP -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].display;
GC gc = SP -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].gc;
XWindowAttributes DrawAreaXYWH = SP -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].DrawAreaXYWH;
Pixmap pixmap = SP -> SEPERATE_WINDOWS_LIST[BUTTON_tune_var].pixmap;
register itmp;
register struct bootmem *bmem;
char *cptr;
char s80[80];
char s256[256];
char s1024[1024];
char *temp_s;
int fwidth = FWIDTH;
int fheight = FHEIGHT;
int len;
int x2 = x;
int yl1 = y + (FASCENT / 2);
int yl2 = y + (fheight / 2) - 1;
int ys = y + FASCENT;
int starting_at = y;
int j = 0;
int current_length = 0;
int tab_count = 0;
cptr = "---Bootinfo-----------";
len = strlen (cptr);
/* the "background" bar */
XSetForeground (display, gc, colorTitleBarBG.pixel);
XSetLineAttributes (display, gc, fheight, line_style, cap_style, join_style);
/*
XDrawLine (display, window, gc, x, yl1, x + (len * fwidth), yl1);
*/
XDrawLine (display, pixmap, gc, x, yl1, x + (len * fwidth), yl1);
/* draw the black line before "Bootinfo" */
XSetForeground (display, gc, colorTitleBarFG.pixel);
XSetLineAttributes (display, gc, FASCENT / 2, line_style, cap_style, join_style);
/*
XDrawLine (display, window, gc,
x2, yl1,
x2 + (len = (fwidth * 3)) - FGAP, yl1);
*/
XDrawLine (display, pixmap, gc,
x2, yl1,
x2 + (len = (fwidth * 3)) - FGAP, yl1);
x2 += len;
/* draw "Bootinfo" */
cptr = "Bootinfo";
/*
XDrawString (display, window, gc, x2, ys, cptr, len = strlen (cptr));
XDrawString (display, window, gc, x2 + 1, ys, cptr, len);
*/
XDrawString (display, pixmap, gc, x2, ys, cptr, len = strlen (cptr));
XDrawString (display, pixmap, gc, x2 + 1, ys, cptr, len);
x2 += fwidth * len;
/* draw the black line after "Bootinfo" */
/*
XDrawLine (display, window, gc,
x2 + FGAP + 1, yl1,
x2 + (len = (fwidth * 11)), yl1);
*/
XDrawLine (display, pixmap, gc,
x2 + FGAP + 1, yl1,
x2 + (len = (fwidth * 11)), yl1);
x2 += len;
y += fheight;
#if defined(M_UNIX)
disp_static_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "basemem ", "%7ldk ", SP -> my_bootinfo -> basemem / 1024);
y += fheight;
disp_static_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "extmem ", "%7ldk ", SP -> my_bootinfo -> extmem / 1024);
y += fheight;
#endif
disp_static_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "bflags ", "%08lx ", SP -> my_bootinfo -> bootflags);
y += fheight;
cptr = "memory available ";
/*
XDrawString (display, window, gc, x, y + FASCENT, cptr, strlen (cptr));
*/
XDrawString (display, pixmap, gc, x, y + FASCENT, cptr, strlen (cptr));
y += fheight;
for (itmp = 0; itmp < SP -> my_bootinfo -> memavailcnt; itmp++)
{
bmem = &SP -> my_bootinfo -> memavail[itmp];
if (bmem -> flags & B_MEM_DOWN)
{
bmem -> base -= bmem -> extent;
bmem -> flags &= ~B_MEM_DOWN;
}
sprintf (s80, "%08lx %08lx %s", bmem -> base, bmem -> extent,
bmemf_text (bmem -> flags));
/*
XDrawString (display, window, gc, x, y + FASCENT, s80, strlen (s80));
*/
XDrawString (display, pixmap, gc, x, y + FASCENT, s80, strlen (s80));
y += fheight;
}
cptr = "memory used ";
/*
XDrawString (display, window, gc, x, y + FASCENT, cptr, strlen (cptr));
*/
XDrawString (display, pixmap, gc, x, y + FASCENT, cptr, strlen (cptr));
y += fheight;
for (itmp = 0; itmp < SP -> my_bootinfo -> memusedcnt; itmp++)
{
bmem = &SP -> my_bootinfo -> memused[itmp];
if (bmem -> flags & B_MEM_DOWN)
{
bmem -> base -= bmem -> extent;
bmem -> flags &= ~B_MEM_DOWN;
}
sprintf (s80, "%08lx %08lx %s", bmem -> base, bmem -> extent,
bmemf_text (bmem -> flags));
/*
XDrawString (display, window, gc, x,
y + FASCENT, s80, strlen (s80));
*/
XDrawString (display, pixmap, gc, x,
y + FASCENT, s80, strlen (s80));
y += fheight;
}
return (y);
} /* end of draw_Bootinfo */
/* vi: set tabstop=4 shiftwidth=4: */
/* end of bootinfo.c */